import processing.core.PConstants;
import processing.core.PImage;


public class openingView extends View {
	
	private String[] topArtists;
	private PImage bg;
	
	public openingView(int _x1, int _y1, int _x2, int _y2) {
		x1 = _x1;
		y1 = _y1;
		x2 = _x2;
		y2 = _y2;
		
		setup();
	}
	
	private void setup() {
		topArtists = LastfmAPI.weeklyTopArtists();
		bg = GLOBAL.processing.loadImage("bgArtists.jpg");
	}
	
	public void draw() {
		GLOBAL.processing.image(bg, x2-400, y1+20);
		
		GLOBAL.processing.textSize(20);
		GLOBAL.processing.textAlign(PConstants.CENTER);
		GLOBAL.processing.text("This Week's Top Artists", (x1+x2)/2, y1+25);
		
		GLOBAL.processing.textSize(12);
		GLOBAL.processing.textAlign(PConstants.LEFT);
		int yOffset = 80;
		for(int x=0; x<20; ++x) {
			if(topArtists == null || topArtists[x] == null)
				break;
			GLOBAL.processing.text("#" + (x+1) + "\t" + topArtists[x], x1+360, y1+yOffset);
			yOffset += 30;
		}
	}

}
